$.ajaxPrefilter(function(option) {
  option.url = "http://ajax.frontend.itheima.net" + option.url
  if(option.url.includes('/my/')) {
    option.complete = function (xhr) {
      if (xhr.responseJSON && xhr.responseJSON.status === 1 && xhr.responseJSON.message === '身份认证失败！') {
        localStorage.removeItem('token');
        location.href = '/login.html';
      }
    },
    option.headers = {
      Authorization: localStorage.getItem('token')
    }
  }
})